#ifndef KERNEL_UTILS_CHARACTER_H
#define KERNEL_UTILS_CHARACTER_H

#include <Mint/Types.h>

static inline bool IsLower( char c )
{
	return c >= 'a' && c <= 'z';
}

static inline bool IsUpper( char c )
{
	return c >= 'A' && c <= 'Z';
}

static inline char ToUpper( char c )
{
	if( IsLower( c ) )
		return c - ( 'a' - 'A' );
	return c;
}

static inline char ToLower( char c )
{
	if( IsUpper( c ) )
		return c - ( 'A' - 'a' );
	return c;
}

static inline char SwitchCase( char c )
{
	if( IsLower( c ) )
		return c - ( 'a' - 'A' );
	else if( IsUpper( c ) )
		return c - ( 'A' - 'a' );
	return c;
}

static inline bool IsAlpha( char c )
{
	return IsLower( c ) || IsUpper( c );
}

static inline bool IsNumeric( char c )
{
	return c >= '0' && c <= '9';
}

static inline bool IsHexNumeric( char c )
{
	return
		( c >= '0' && c <= '9' ) ||
		( c >= 'a' && c <= 'f' ) ||
		( c >= 'A' && c <= 'F' );
}

static inline bool IsAlphaNumeric( char c )
{
	return IsAlpha( c ) || IsNumeric( c );
}

static inline bool IsPunctuation( char c )
{
	return
		( c >= '!' && c <= '/' ) ||
		( c >= ':' && c <= '@' ) ||
		( c >= '[' && c <= '`' ) ||
		( c >= '{' && c <= '~' );
}

static inline bool IsWhitespace( char c )
{
	return c == '\r' || c == '\n' || c == '\t' || c == ' ';
}

static inline bool IsPrintable( char c )
{
	return IsAlphaNumeric( c ) || IsPunctuation( c ) || IsWhitespace( c );
}

#endif // KERNEL_UTILS_CHARACTER_H
